using System;
using Locomotion;
using UnityEngine;
using UnityEngine.UI;

namespace UI
{
    public class GameOverScreen : MonoBehaviour
    {
        [SerializeField] private GameOverDetector gameOverDetector;
        [SerializeField] private UiFader restartButtonFader;
        [SerializeField] private ChangeSceneButton restartButton;
    
        // Start is called before the first frame update
        void Start()
        {
            gameOverDetector.GameOver += GameOverDetector_GameOver;
            restartButton.enabled = false;
        }

        private void OnDestroy()
        {
            gameOverDetector.GameOver -= GameOverDetector_GameOver;
        }

        private void GameOverDetector_GameOver()
        {
            restartButtonFader.Show();
            restartButton.enabled = true;
        }
    }
}
